package concurrent;

import java.util.concurrent.*;

/**
 * @author 26029
 * @date 2025/4/29
 * @description
 */
public class LearnFutureTask {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<String> task = new FutureTask<>(() -> {
            System.out.println("0%");
            System.out.println("50%");
            System.out.println("100%");
            return "任务完成：手动执行 FutureTask";
        });
        new Thread(task).start(); // 用线程显式执行任务
        System.out.println("结果：" + task.get());
    }
}
